package com.wh.system.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wh.system.pojo.Menu;
import com.wh.system.pojo.RolePermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface RolePermissionDao extends BaseMapper<RolePermission> {

    List<RolePermission> findByPage(@Param("page")IPage<RolePermission> page, @Param("qw") QueryWrapper<RolePermission> queryWrapper);

    /**
     * 根据角色ID，查询角色所拥有的权限
     * @param roleId 角色id
     * @return
     */
    List<Long> findPermissionIdByRoleId(Long roleId);

    void deleteByRoleId(Long id);

    void UpdatePression(Integer permissionId, Long roleId);
}
